home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / viewkit / builderExamples / beep2 / BeeperUI.c++ < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  3.5 KB  |  126 lines

  1. /////////////////////////////////////////////////////////////
  2. //
  3. // Source file for BeeperUI
  4. //
  5. //    This file generated by a BuilderXcessory.  DO NOT EDIT THIS FILE.
  6. //    TO ADD EXTENSIONS TO THIS CLASS, USE THE BUILDER XCESSORY
  7. //    TO CREATE A SUBCLASS.
  8. //
  9. //    This class is a user interface "component", as described
  10. //    in "Object-Oriented Programming with C++ and OSF/Motif",
  11. //    by Douglas Young, Prentice Hall, 1992. ISBN 0-13-630252-1
  12. //
  13. //
  14. /////////////////////////////////////////////////////////////
  15.  
  16.  
  17. #include "BeeperUI.h" // Generated header file for this class
  18. #include <Xm/BulletinB.h> 
  19. #include <Xm/Label.h> 
  20. #include <Xm/PushB.h> 
  21. #ifndef XmNrow    
  22. #define XmNrow "row"
  23. #endif    
  24. #ifndef XmNcolumn    
  25. #define XmNcolumn "column"
  26. #endif     
  27.  
  28.  
  29.  
  30.  
  31.  
  32. // These are default resources for widgets in objects of this class
  33. // All resources will be prepended by *<name> at instantiation,
  34. // where <name> is the name of the specific instance, as well as the
  35. // name of the baseWidget. These are only defaults, and may be overriden
  36. // in a resource file by providing a more specific resource name
  37.  
  38. String  BeeperUI::_defaultBeeperUIResources[] = {
  39.         NULL
  40. };
  41.  
  42. BeeperUI::BeeperUI(const char *name, Widget parent) : 
  43.          VkComponent(name) 
  44.     Arg      args[5];
  45.     Cardinal count;
  46.  
  47.     count = 0;
  48.  
  49.     // Load any class-defaulted resources for this object
  50.  
  51.     setDefaultResources(parent, _defaultBeeperUIResources  );
  52.  
  53.  
  54.  
  55.     // Create an unmanaged widget as the top of the widget hierarchy
  56.  
  57.     _baseWidget = _beeper= XtVaCreateWidget ( _name,
  58.                                         xmBulletinBoardWidgetClass,
  59.                                         parent, 
  60.                                             XmNresizePolicy, XmRESIZE_GROW, 
  61.                                         NULL); 
  62.  
  63.     // install a callback to guard against unexpected widget destruction
  64.  
  65.     installDestroyHandler();
  66.  
  67.  
  68.     // Create widgets used in this component
  69.     // All variables are data members of this class
  70.  
  71.     _pushButton = XtVaCreateManagedWidget  ( "pushButton",
  72.                                             xmPushButtonWidgetClass,
  73.                                             _w, 
  74.                                             XmNx, 96, 
  75.                                             XmNy, 106, 
  76.                                             XmNwidth, 127, 
  77.                                             XmNheight, 60, 
  78.                                             NULL); 
  79.  
  80.     XtAddCallback ( _pushButton,
  81.                     XmNactivateCallback,
  82.                     &BeeperUI::beepCallback,
  83.                     (XtPointer) this ); 
  84.  
  85.  
  86.     _label = XtVaCreateManagedWidget  ( "label",
  87.                                             xmLabelWidgetClass,
  88.                                             _w, 
  89.                                             XmNx, 61, 
  90.                                             XmNy, 20, 
  91.                                             XmNwidth, 192, 
  92.                                             XmNheight, 41, 
  93.                                             NULL); 
  94.  
  95.  
  96. }
  97.  
  98. BeeperUI::~BeeperUI() 
  99. {
  100.     // Empty Destructor. Base class destroys widgets
  101. }
  102.  
  103. const char * BeeperUI::className() // classname
  104. {
  105.     return ("BeeperUI");
  106. }
  107.  
  108. void BeeperUI::beepCallback (Widget w, XtPointer clientData, XtPointer callData) 
  109.     BeeperUI* obj = (BeeperUI *) clientData;
  110.  
  111.     obj->beep(w, callData);
  112. }
  113.  
  114.  
  115.  
  116. void BeeperUI::beep(Widget, XtPointer) 
  117. {
  118.     // Empty virtual function. Called from beepCallback.
  119.     // Derived classes can override.
  120. }
  121.  
  122.  
  123.  
  124.